package com.zyx.javademo.stream;

import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * @author Yaxi.Zhang
 * @since 2021/9/30 16:20
 */
public class StreamCollectorDemo {
    public static void main(String[] args) {
        IntStream.range(0, 4).forEach(i -> System.out.println("i = " + i));
        HashSet<String> set = Stream.of("a1", "a2", "a3").collect(Collectors.toCollection(HashSet::new));
        System.out.println("set = " + set);

        List<Integer> list = Stream.of(1001, 1002, 1003).collect(Collectors.toList());
        System.out.println("list = " + list);
    }
}
